package com.imy.luascript.viewmodel;


import com.imy.luascript.app.data.BaseListResponse;
import com.imy.luascript.retrofit.ListRequestCallBackListenerImpl;

import rx.Observable;

/**
 * @ProjectName: frame
 * @Package: com.imy.frame.viewmodel
 * @ClassName: SimpleListViewModel
 * @Description: 描述
 * @Author: Imy
 * @CreateDate: 2020/11/3 16:16
 */
public abstract class SimpleListViewModel<T> extends BaseListViewModel {

    public SimpleListViewModel(BaseImplView implView) {
        super(implView);
    }

    @Override
    public void loadData() {
        load(listRequestCallBackListener);
    }

    public void load(ListRequestCallBackListenerImpl<T> listRequestCallBackListener) {
        this.listRequestCallBackListener = listRequestCallBackListener;
        startListRequest(getApi(), listRequestCallBackListener);
    }

    protected abstract Observable<BaseListResponse<T>> getApi();

    private ListRequestCallBackListenerImpl<T> listRequestCallBackListener;
}